package com.kavitha.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kavitha.model.Calculator;

@Component
@Controller
public class MainController {

	@RequestMapping("calc.do")
	public ModelAndView calculate(Calculator calculator, HttpServletRequest request, HttpServletResponse response, HttpSession session){
		ModelAndView modelAndView = new ModelAndView("index");
		modelAndView.addObject("result", calculator.result());
		return modelAndView;
	}
	
}
